package com.nuoniu.sibanyun.controller.crm.call;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallAgentSearchDto;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallAgentStatisticsSearchDto;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallAgentStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 客户管理-坐席统计 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/crm/callAgentStatistics")
@Api(value="坐席统计 ",tags={"坐席统计"})
public class CrmCallAgentStatisticsController extends BaseController {

    @Autowired
    private ICrmCallAgentStatisticsService agentStatisticsService;

    @PostMapping("pageAgentStatisticsBySystem")
    @ApiOperation(value = "分页查询 坐席统计")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult pageAgentStatisticsBySystem(@RequestBody CrmCallAgentStatisticsSearchDto crmCallAgentStatisticsSearchDto) {
        return HttpResult.ok(agentStatisticsService.pageAgentStatisticsBySystem(crmCallAgentStatisticsSearchDto));
    }


    @GetMapping("getCrmCallAgentStatistics")
    @ApiOperation(value = "获取当前租户的坐席统计数据")
    public HttpResult getCrmCallAgentStatistics() {
        return HttpResult.ok(agentStatisticsService.getCrmCallAgentStatistics());
    }
    @GetMapping("getByCompanyId")
    @ApiOperation(value = " 通过租户ID查询统计")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult getByCompanyId(Integer companyId) {
        return HttpResult.ok(agentStatisticsService.getByCompanyId(companyId));
    }

}
